The present invention relates generally to a compiler system for creating object codes which allow a super computer to perform vectorization processing starting from a source program. More particularly, the present invention is concerned with a program translation system or method capable of creating an object code or program having a high efficiency of execution by resorting to the vectorization processing of outer one of multiple do-loops in a program in which the innermost loop is executed only at a low ratio.
In the super computer such as, for example, "Super Computer S 810" commercially available from the assignee of the present application, there are incorporated vector registers which can hold simultaneously individual elements of arrays and vector operation units for executing arithmetic operations on the vector registers at a high speed. By making use of the vector register and the vector operation unit effectively, it is possible to execute at a high speed the processing required for the loop which is to be executed repeatedly in a source program. The term "vectorization" used herein means the translation or transformation of the repetive loop of the source program into an object code which can be executed by using the vector register and the vector operation unit. Further, the ratio of a part which is executed by the vector operation unit to the whole program is termed "ratio of vectorization".
In the super computer, it is generally known that higher execution efficiency can be attained for the object code when the ratio of vectorization is high. In the hitherto known compiler, the innermost loop has been subject to the vector operation and numerous program translations are adopted for the vectorizations of the innermost loop. Of these translations, there is known an expansion procedure for substituting arrays for variables, as exemplified below: ##EQU1##
The object code obtained from the source program through the straightforward vectorization undergoes the processing described below. In the first place, values of the lst to 100-th elements of the arrays X and Y are loaded into the associated vector registers, being followed by division for each of the elements, wherein the finally obtained results are placed in the variables S. Subsequently, the 1st to 100-th elements of the array A are loaded in the vector registers and multiplied with the contents of the variable S, the resulting values being then transferred from the vector register to the array B in a storage to be stored at the 1st to 100-th elements of the array B. This procedure is equivalent to the program translation mentioned below: ##EQU2##
However, straightforward execution will result in that only the value of S=X(100)/Y(100) obtained upon completion of the loop "DO 10" can be used in the arithmetic operation for the loop "DO 11", which means that the result of the arithmetic operation differs from what can be obtained from execution of the program which has not undergone the transformation. Accordingly, in order to allow the same arithmetic operation as the one before the transformation to be performed, it is necessary to substitute arrays for the variable S for preserving all the values of I=1, 100 so that they can be used in the execution of the "DO 11" loop. The expansion for the substitution may be made as follows: ##EQU3##
The transformation of the variables to the arrays as exemplified above is referred to as "expansion". In this context, the array such as "S" generated by the compiler is referred to as "temporary array". As the article concerning the expansion procedure published latest, there may be mentioned Kuck et al's "Dependence Graphs and Compiler Optimization", SIGPLAN, Principles of Programming Languages, Jan. 1981, p.p. 207-218.
In the article mentioned above, discussion is made on the system for expansion only of the variables that make appearance in the innermost loop of multiple loops. More specifically, when a loop of concern is the innermost one of the multiple loops in a number of n, the variables are substituted for the n-dimensional arrays, as exemplified below: ##EQU4##
Obviously, discussion is made on the expansion of "P" and no consideration is paid to the variable such as "S" which makes appearance over two loops.
With the prior art compiler, the variable can be replaced by the array for the innermost loop to thereby generate the object code for permitting the arithmetic operation to be executed by means of the vector operation unit in the same manner as the serial execution. However, in order to enhance the efficiency of execution for the object code, not only the innermost one of the multiple loops but also the outer adjacent loop must be susceptible to the vector operation. By way of example, in the case of a program ##EQU5## the variables S in the innermost loop can be replaced by the arrays for allowing the vector processing. However with the prior art compiler, no consideration is given to the variable S in the outer loop, thus giving rise to a serious problem that the vector operation according to the prior art involves the results which differ from those of the serial arithmetic operation.